package com.lst.tools.quartz.properties;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Properties;

/**
 * 芝麻认证配置参数
 *
 * @author: Frank
 * @date: 2019/09/24 13:51
 * @version: V1.0
 */
@Data
@NoArgsConstructor
@Component
public class QuartzProperties {
    @Value("${org.quartz.scheduler.instanceName}")
    private String schedulerInstanceName;

    @Value("${org.quartz.scheduler.instanceId}")
    private String schedulerInstanceId;

    @Value("${org.quartz.jobStore.class}")
    private String jobStoreClass;

    @Value("${org.quartz.jobStore.driverDelegateClass}")
    private String jobStoreDriverDelegateClass;

    @Value("${org.quartz.jobStore.tablePrefix}")
    private String jobStoreTablePrefix;

    @Value("${org.quartz.jobStore.isClustered}")
    private String jobStoreIsClustered;

    @Value("${org.quartz.jobStore.useProperties}")
    private String jobStoreUseProperties;

    @Value("${org.quartz.jobStore.clusterCheckinInterval}")
    private String jobStoreClusterCheckinInterval;

    @Value("${org.quartz.threadPool.class}")
    private String threadPoolClass;

    @Value("${org.quartz.threadPool.threadCount}")
    private String threadPoolThreadCount;

    @Value("${org.quartz.threadPool.threadPriority}")
    private String threadPoolThreadPriority;

    @Value("${org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread}")
    private String threadPoolThreadsInheritContextClassLoaderOfInitializingThread;

    public Properties getQuartzProperties() {
        Properties properties = new Properties();
        properties.put("org.quartz.scheduler.instanceName", this.schedulerInstanceName);
        properties.put("org.quartz.scheduler.instanceId", this.schedulerInstanceId);
        properties.put("org.quartz.jobStore.class", this.jobStoreClass);
        properties.put("org.quartz.jobStore.driverDelegateClass", this.jobStoreDriverDelegateClass);
        properties.put("org.quartz.jobStore.tablePrefix", this.jobStoreTablePrefix);
        properties.put("org.quartz.jobStore.isClustered", this.jobStoreIsClustered);
        properties.put("org.quartz.jobStore.useProperties", this.jobStoreUseProperties);
        properties.put("org.quartz.jobStore.clusterCheckinInterval", this.jobStoreClusterCheckinInterval);
        properties.put("org.quartz.threadPool.class", this.threadPoolClass);
        properties.put("org.quartz.threadPool.threadCount", this.threadPoolThreadCount);
        properties.put("org.quartz.threadPool.threadPriority", this.threadPoolThreadPriority);
        properties.put("org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread", this.threadPoolThreadsInheritContextClassLoaderOfInitializingThread);
        return properties;
    }
}
